<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html;charset=UTF-8" isELIgnored="false"%>
<%@ page import="com.example.bbs.model.User" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>

<html>
<head>
	<title>登录页面</title>
	<meta charset="utf-8"/>
	<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
	<style>
		span{
			display:inline-block;
		}
		p span:nth-of-type(1){
			width:80px;
			text-align:right;
		}
		
		p span:nth-of-type(2){
			width:180px;
		}
		
		p span:nth-of-type(3){
			color:red;
		}
		p a{
			margin-left:30px;
		}
		
		
		form{
			width:400px;
			margin:0px auto;
		}
	</style>
</head>

<body>
<%
	Cookie[] cookies = request.getCookies();
	if (cookies != null) {
		for (int i = 0; i < cookies.length; i++) {
			if (cookies[i].getName().equals("loginUser")) {
//				session.setAttribute("loginUser", cookies[i].getValue());
				response.sendRedirect("boards.jsp");
				return;
			}
		}
	}


%>
	<div class="container">
		<form action="doLogin.action" method="post">
			<p name="fail"><span></span><span style="color: red;margin: 0px;">${fail}</span></p>
			<p><span>用户名:</span><span><input name="userName"/></span><span>请输入用户名</span></p>
			<p><span>密码:</span><span><input name="userPassword" type="password"/></span><span></span></p>
			<p><span></span><span><input  type="submit" value="登录"/><a href="reg.jsp">注册</a></span></p>
		</form>
	</div>
</body>
<script type="text/javascript">

</script>
</html>
